﻿using System.Windows.Forms;

namespace ASmile.Win
{
    public partial class UcBaseControl : UserControl
    {
        public UcBaseControl()
        {
            InitializeComponent();
        }

        FrmBase _HostForm;
        /// <summary>
        /// 父级窗体
        /// </summary>
        public FrmBase HostForm
        {
            get
            {
                if (_HostForm == null)
                {
                    _HostForm = this.FindForm() as FrmBase;
                }
                return _HostForm;
            }
        }

        /// <summary>
        /// 显示文本消息
        /// </summary>
        public void ShowMessage(string msg)
        {
            if (HostForm != null)
            {
                HostForm.ShowMessage(msg);
            }
            else
            {
                MessageBox.Show(msg);
            }
        }
    }
}
